package com.len.controller;

import com.alibaba.fastjson.JSONArray;
import com.len.base.BaseController;
import com.len.service.NodeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@RequestMapping("/node")
@Controller
public class NodeController extends BaseController {

    @Autowired
    NodeService nodeService;

    @GetMapping("showNode")
    @RequiresPermissions("node:show")
    public String showNode(Model model) {
        JSONArray ja = nodeService.getNodeJsonList();
        model.addAttribute("nodes", ja.toJSONString());
        return "/node/nodeList";
    }


}
